﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Artemis;

namespace JAWWS
{
    class WallNode : SceneGraphNode
    {
        public Wall wall;
        public uint texID;

        const float WALL_X = 2.0f;
        const float WALL_Y =  1.0f;
        const float WALL_Z = 2.0f;

        public WallNode(MainForm main)
        {
            this.child = null;
            this.sibling = null;
            this.wall = new Wall(main);
            float[] IdMatrix  =     {1.0f,0.0f,0.0f,0.0f,
                                     0.0f,1.0f,0.0f,0.0f,
                                     0.0f,0.0f,1.0f,0.0f,
                                     0.0f,0.0f,0.0f,1.0f};
            this.LocalTransMatrix = this.IdMatrix;
        }
        public override void draw()
        {
            GL.glEnable(GLenum.GL_TEXTURE_2D);
            GL.glBindTexture(GLenum.GL_TEXTURE_2D, wall.texID);
            wall.draw();
            GL.glDisable(GLenum.GL_TEXTURE_2D);
        }
        public  void updateNode(float transX, float transY, float transZ,
                               float scalarX, float scalarY,float scalarZ,
                               float rotAng, float xaxis, float yaxis, float zaxis)
        {
            GL.glMatrixMode(GLenum.GL_MODELVIEW);
            GL.glPushMatrix();
                GL.glLoadIdentity();
                GL.glTranslatef(transX, transY, transZ);
                GL.glRotatef(rotAng, xaxis, yaxis, zaxis); 
                GL.glScalef(scalarX, scalarY, scalarZ);    
                GL.glGetFloatv(GLenum.GL_MODELVIEW_MATRIX, this.LocalTransMatrix);
            GL.glPopMatrix();
        }
    }
}
